<?php
namespace RMD\AccountBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

use RMD\AccountBundle\Entity\GroupSet;

class GroupSetType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder->add('title', 'text');
		$builder->add('selectType', 'choice', array(
			'choices'   => array(GroupSet::SIGLE_CHOICE => 'Single choice', GroupSet::MULTI_CHOICE => 'Multiple choice'),
			'required'  => true,
			'multiple'  => false,
			'expanded'  => true,
		));
		$builder->add('groups', 'collection', array(
			'type' => new GroupType(),
			'allow_add' => true,
			'allow_delete' => true,
			'by_reference' => false
		));
		}

    public function getName() {
        return 'groupset';
    }
    
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'RMD\AccountBundle\Entity\GroupSet',
            'intention'       => 'groupset_item'
        ));
    }
}
?>
